---
{
	"title": "Multimedia Player",
	"language": "en",
	"category": "Plugins",
	"categoryfile": "plugins",
	"description": "Provides an accessible multimedia player for embedding video and audio into web pages.",
	"altLangPrefix": "multimedia",
	"dateModified": "2023-06-16"
}
---
<span class="wb-prettify all-pre hide"></span>

<section>
	<h2>Purpose</h2>
	<p>Provides an accessible multimedia player for embedding video and audio into web pages.</p>
</section>

<section>
	<h2>Examples</h2>
	<ul>
		<li><a href="../../../demos/multimedia/multimedia-en.html">English video example</a></li>
		<li><a href="../../../demos/multimedia/multimedia-fr.html">French video example</a></li>
		<li><a href="../../../demos/multimedia/multimedia-audio-en.html">English audio example</a></li>
		<li><a href="../../../demos/multimedia/multimedia-audio-fr.html">French audio example</a></li>
		<li><a href="../../../demos/multimedia/multimedia-youtube-en.html">English YouTube example</a></li>
		<li><a href="../../../demos/multimedia/multimedia-youtube-fr.html">French YouTube example</a></li>
	</ul>
</section>

<section>
<h2>Evaluation and report</h2>
<ul>
	<li>Accessibility (SC WCAG 2.1/2.2 Level A &amp; AA)- <a href="../../../demos/multimedia/reports/a11y-1-audio-en.html">English Audio Only Report</a></li>
	<li>Accessibility (SC WCAG 2.1/2.2 Level A &amp; AA)- <a href="../../../demos/multimedia/reports/a11y-1-audio-fr.html">French Audio Only Report</a></li>
	<li>Accessibility (SC WCAG 2.1/2.2 Level A &amp; AA)- <a href="../../../demos/multimedia/reports/a11y-1-video-en.html">English Video Report</a></li>
	<li>Accessibility (SC WCAG 2.1/2.2 Level A &amp; AA)- <a href="../../../demos/multimedia/reports/a11y-1-video-fr.html">French Video Report</a></li>
</ul>
</section>

<section>
	<h2>How to implement</h2>
	<p>The multimedia player requires the use of a few HTML5 tags and a link to the media source you wish to embed.</p>
	<section>
		<h3>Media Formats</h3>
		<p>The media player supports several formats, listed below; however, we recommend at a minimum you provide any video media in MPEG4 (using the H264 and AAC codecs) to be able to reach every audience, as all mobile players and most browsers are able to play this format. We also recommend you provide media in the WebM format (using the VP8 codec) in addition to MPEG4 in order to take advantage of native browser support, for example Firefox.</p>
		<section>
			<h4>Compatible Formats</h4>
			<ul>
				<li><strong>Video:</strong> MPEG4 (H264+AAC), WebM (VP8)</li>
				<li><strong>Audio:</strong> MP3, Ogg Vorbis</li>
				<li><strong>Captions:</strong> TTML, HTML5 Data</li>
			</ul>
		</section>
	</section>
	<section>
		<h3>Required Elements</h3>
		<ol>
			<li>Each multimedia player must be placed in its own <code>&lt;figure&gt;</code> using the <code>wb-mltmd</code> class:
				<pre><code>&lt;figure class="wb-mltmd"&gt;</code></pre>
			</li>
			<li>Each container should contain one <code>&lt;video&gt;</code> or <code>&lt;audio&gt;</code> tag.</li>
			<li>
				<strong>Optional:</strong> Add a "Share this video" or "Share this audio file" link by adding the following to the <code>figure</code> element:
				<pre><code>data-wb-mltmd='{"shareUrl": "url"}'</code></pre>
			</li>
			<li>
				Add a <code>figcaption</code> element to the <code>figure</code> element with the title of the video or audio file. If a transcript is required, then also include either a link to the transcript or a details/summary containing the transcript.
					<pre><code>&lt;figcaption&gt;
	&lt;p&gt;Looking for a Job&lt;/p&gt;
&lt;/figcaption&gt;</code></pre>
					<pre><code>&lt;figcaption&gt;
	&lt;p&gt;Looking for a Job (&lt;a href="cpts-lg-en.html"&gt;Transcript&lt;/a&gt;)&lt;/p&gt;
&lt;/figcaption&gt;</code></pre>
					<pre><code>&lt;figcaption&gt;
	&lt;details id="inline-captions"&gt;
		&lt;summary&gt;Looking for a Job - HTML5 Transcript/Captions&lt;/summary&gt;
		&lt;p class="wet-boew-vd"&gt;&lt;strong&gt;(Animated pen draws a red line that leads into the text Looking for A Job)&lt;/strong&gt;&lt;/p&gt;
		&lt;p class="wet-boew-vd"&gt;&lt;strong&gt;(Cut to a medium shot of the Host. LINE DRAWING GRAPHIC: Stick person appears and waves.)&lt;/strong&gt;&lt;/p&gt;
		&lt;p&gt;&lt;span class="wb-tmtxt" data-begin="2.50s" data-dur="3.84s"&gt;Hi, my name is Eric, and I&#39;m a Service Canada employee.&lt;/span&gt;&lt;/p&gt;
		...
	&lt;/details&gt;
&lt;/figcaption&gt;</code></pre>
			</li>
		</ol>

		<section>
			<h4>Video</h4>
			<ol>
				<li>Add a <code>poster</code> attribute to the <code>video</code> element with the value being the URL for the thumbnail image.</li>
				<li>Add a <code>title</code> attribute to the <code>video</code> element with the value being the title of the video.</li>
				<li>
					Add one or more <code>source</code> elements to the <code>video</code> element with the <code>src</code> attribute value being the URL of the media file and the <code>type</code> attribute being the media file MIME type.<br>
					<strong>Note:</strong> If you list multiple media sources for the video, the player will play the first media source file that works (is available, compatible, etc.).
					<pre><code>&lt;source type="video/webm" src="https://video2.servicecanada.gc.ca/video/boew-wet/te-lj-eng.webm" /&gt;
&lt;source type="video/mp4" src="https://video2.servicecanada.gc.ca/video/boew-wet/te-lj-eng.mp4" /&gt;</code></pre>
				</li>
				<li>Add a <code>track</code> element with <code>kind="captions"</code> to the <code>video</code> element to add captions.
					<ol>
						<li>
							Add the <code>srclang</code> and <code>label</code> attributes to the <code>track</code> element to identify the captions language.
							<pre><code>&lt;track srclang="en" label="English" /&gt;</code></pre>
						</li>
						<li>Add the <code>src</code> and <code>data-type</code> attributes to the <code>track</code> element to identify the source of the captions.
							<ul>
								<li><strong>Timed Text Markup Language:</strong> <code>data-type="application/ttml+xml"</code> and <code>src</code> is the URL of the <a rel="external" href="https://www.w3.org/TR/ttaf1-dfxp/">Timed Text Markup Language</a> captions file.</li>
								<li><strong>HTML captions file:</strong> <code>data-type="text/html"</code> and <code>src</code> is the URL of the HTML captions file.</li>
								<li><strong>Inline HTML captions:</strong> <code>data-type="text/html"</code> and <code>src</code> is the URL of the inline HTML captions (e.g., <code>src="#inline-captions"</code>.</li>
							</ul>
						</li>
					</ol>
					<pre><code>&lt;track src="cpts-lg-en.html" kind="captions" data-type="text/html" srclang="en" label="English" /&gt;</code></pre>
				</li>
				<li><strong>Optional: </strong>Add buttons to link to cue points within your video.
					<ul>
						<li>Add a <code>button</code> element within the <code>figure</code> container.</li>
						<li>Specify the cue point in seconds (ex. 75s) or time notation (01:15)</li>
					</ul>
					<pre><code>&lt;button class="btn btn-info cuepoint" data-cuepoint="75s"&gt;Cue point - 75s&lt;/button&gt;</code></pre>
					<pre><code>&lt;button class="btn btn-info cuepoint" data-cuepoint="01:15"&gt;Cue point - 01:15&lt;/button&gt;</code></pre>
				</li>
			</ol>

			<section>
				<h5>Code</h5>
				<pre><code>&lt;figure class="wb-mltmd" data-wb-mltmd='{"shareUrl": "https://wet-boew.github.io/v4.0-ci/demos/multimedia/multimedia-en.html"}'&gt;
	&lt;video poster="demo/video1-en.jpg" title="Looking for a Job"&gt;
		&lt;source type="video/webm" src="https://video2.servicecanada.gc.ca/video/boew-wet/te-lj-eng.webm" /&gt;
		&lt;source type="video/mp4" src="https://video2.servicecanada.gc.ca/video/boew-wet/te-lj-eng.mp4" /&gt;
		&lt;track src="cpts-lg-en.html" kind="captions" data-type="text/html" srclang="en" label="English" /&gt;
	&lt;/video&gt;
	&lt;button class="btn btn-info cuepoint" data-cuepoint="75s"&gt;Cue point - 75s&lt;/button&gt;
	&lt;figcaption&gt;
		&lt;p&gt;Looking for a Job (&lt;a href="cpts-lg-en.html"&gt;Transcript&lt;/a&gt;)&lt;/p&gt;
	&lt;/figcaption&gt;
&lt;/figure&gt;</code></pre>
			</section>
		</section>

		<section>
			<h4>Video (YouTube)</h4>
			<ol>
				<li>Add a <code>title</code> attribute to the <code>video</code> element with the value being the title of the video.</li>
				<li>
					<p>Add a <code>source</code> element to the <code>video</code> element with <code>type="video/youtube"</code> and the <code>src</code> attribute being the URL of the video.</p>
					<pre><code>&lt;source type="video/youtube" src="https://www.youtube.com/watch?v=9znKJqnFuuY" /&gt;</code></pre>
					<p>or</p>
					<pre><code>&lt;source type="video/youtube" src="https://youtu.be/9znKJqnFuuY" /&gt;</code></pre>
				</li>
				<li>If captions are not already included for the video, add the captions using the tools provided by YouTube.</li>
			</ol>

			<section>
				<h5>Code</h5>
			<pre><code>&lt;figure class="wb-mltmd"&gt;
	&lt;video title="Suspect"&gt;
		&lt;source type="video/youtube" src="https://www.youtube.com/watch?v=9znKJqnFuuY" /&gt;
	&lt;/video&gt;
	&lt;figcaption&gt;
		&lt;p&gt;Suspect&lt;/p&gt;
	&lt;/figcaption&gt;
&lt;/figure&gt;</code></pre>
			</section>
		</section>

		<section>
			<h4>Audio</h4>
			<ol>
				<li>Add a <code>title</code> attribute to the <code>audio</code> element with the value being the title of the audio.</li>
				<li>
					Add one or more <code>source</code> elements to the <code>audio</code> element with the <code>src</code> attribute value being the URL of the media file and the <code>type</code> attribute being the media file MIME type.<br>
					<strong>Note:</strong> If you list multiple media sources for the audio, the player will play the first media source file that works (is available, compatible, etc.).
					<pre><code>&lt;source src="https://www.archive.org/download/RideOfTheValkyries/ride_of_the_valkyries_2.mp3" type="audio/mp3" /&gt;
&lt;source src="https://www.archive.org/download/RideOfTheValkyries/ride_of_the_valkyries_2.ogg" type="audio/ogg" /&gt;</code></pre>
				</li>
			</ol>

			<section>
				<h5>Code</h5>
				<pre><code>&lt;figure class="wb-mltmd"&gt;
	&lt;audio title="Ride of the Valkyries"&gt;
		&lt;source src="https://www.archive.org/download/RideOfTheValkyries/ride_of_the_valkyries_2.mp3" type="audio/mp3" /&gt;
		&lt;source src="https://www.archive.org/download/RideOfTheValkyries/ride_of_the_valkyries_2.ogg" type="audio/ogg" /&gt;
	&lt;/audio&gt;
	&lt;figcaption&gt;
		&lt;p&gt;Ride of the Valkyries&lt;/p&gt;
	&lt;/figcaption&gt;
&lt;/figure&gt;</code></pre>
			</section>
		</section>
	</section>
</section>

<section>
	<h2>Configuration options</h2>
	<table class="table">
		<thead>
			<tr>
				<th>Option</th>
				<th>Description</th>
				<th>How to configure</th>
				<th>Values</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><code>shareUrl</code></td>
				<td>Adds a "Share this video" or "Share this audio file" link</td>
				<td>Add <pre><code>data-wb-mltmd='{"shareUrl": "url"}'</code></pre> to the element with <code>class="wb-mltmd"</code>.</td>
				<td>
					<dl>
						<dt>URL</dt>
						<dd>URL of the video or audio file to share.</dd>
					</dl>
				</td>
			</tr>
			<tr>
				<td><code>fullscreenBtn</code></td>
				<td>
					<p>Adds a button to display the video in full screen.</p>
					<p>Note: the button is not added by default because the controls are not visible when in full screen.</p>
				</td>
				<td>Add <pre><code>data-wb-mltmd='{"fullscreenBtn": true}'</code></pre> to the element with <code>class="wb-mltmd"</code>.</td>
				<td>
					<dl>
						<dt><code>false (default)</code></dt>
						<dd>The video does not display a button for fullscreen</dd>
						<dt><code>true</code></dt>
						<dd>The video displays a button for fullscreen</dd>
					</dl>
				</td>
			</tr>
		</tbody>
	</table>
</section>

<section>
	<h2>Events</h2>
	<table class="table">
		<thead>
			<tr>
				<th>Event</th>
				<th>Trigger</th>
				<th>What it does</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td><code>wb-init.wb-mltmd</code></td>
				<td>Triggered manually (e.g., <code>$( ".wb-mltmd" ).trigger( "wb-init.wb-mltmd" );</code>).</td>
				<td>Used to manually initialize the multimedia player. <strong>Note:</strong> The multimedia player will be initialized automatically unless the multimedia player markup is added after the page has already loaded.</td>
			</tr>
			<tr>
				<td><code>wb-ready.wb-mltmd</code> (v4.0.5+)</td>
				<td>Triggered automatically after a multimedia player initializes.</td>
				<td>Used to identify which multimedia player initialized (target of the event)
					<pre><code>$( document ).on( "wb-ready.wb-mltmd", ".wb-mltmd", function( event ) {
});</code></pre>
					<pre><code>$( ".wb-mltmd" ).on( "wb-ready.wb-mltmd", function( event ) {
});</code></pre>
				</td>
			</tr>
			<tr>
				<td><code>wb-ready.wb</code> (v4.0.5+)</td>
				<td>Triggered automatically when WET has finished loading and executing.</td>
				<td>Used to identify when all WET plugins and polyfills have finished loading and executing.
					<pre><code>$( document ).on( "wb-ready.wb", function( event ) {
});</code></pre>
				</td>
			</tr>
		</tbody>
	</table>
</section>

<section>
	<h2>Source code</h2>
	<p><a href="https://github.com/wet-boew/wet-boew/tree/master/src/plugins/multimedia">Multimedia player source code on GitHub</a></p>
</section>
